<?php

use Illuminate\Database\Seeder;
use App\Models\ActivityModel\ActivityModel;
use App\Models\ActivityModelTemplate\ActivityModelTemplate;

class ActivityModelTemplateSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        /*
        $redpack = ActivityModel::query()->firstOrCreate([
            'name' => '红包雨',
            'rule' => 'redpack_rain',
        ]);

        ActivityModelTemplate::query()->firstOrCreate([
            'model_id' => $redpack->id,
            'name' => '红包雨',
            'template' => 'default',
            'thumb' => '/images/admin/redpack_rain.jpg',
            'url' => '/act/redpackrain/index.html',
            'isBackgroundImage' => true,
            'isBackgroundColor' => false,
        ]);
        */

        $vote = ActivityModel::query()->firstOrCreate([
            'name' => '投票',
            'rule' => 'vote'
        ]);

        ActivityModelTemplate::query()->firstOrCreate([
            'model_id' => $vote->id,
            'name' => '投票',
            'template' => 'default',
            'thumb' => '/images/admin/vote.jpg',
            'url' => '/act/vote/index.html',
            'isBackgroundImage' => true,
            'isBackgroundColor' => false,
        ]);

        ActivityModelTemplate::query()->firstOrCreate([
            'model_id' => $vote->id,
            'name' => '投票',
            'template' => 'poll',
            'thumb' => '/images/admin/poll.jpg',
            'url' => '/act/poll/index.html',
            'isBackgroundImage' => true,
            'isBackgroundColor' => false,
        ]);

        /* 揭阳投票 */
        ActivityModelTemplate::query()->firstOrCreate([
            'model_id' => $vote->getAttribute('id'),
            'name' => '投票',
            'template' => 'ballot',
            'thumb' => '/images/admin/ballot.png',
            'url' => '/act/ballot/index.html',
            'isBackgroundImage' => true,
            'isBackgroundColor' => false,
        ]);
        /* 16:9 */
        ActivityModelTemplate::query()->firstOrCreate([
            'model_id' => $vote->getAttribute('id'),
            'name' => '投票',
            'template' => 'vote-screen',
            'thumb' => '/images/admin/vote-screen.jpg',
            'url' => '/act/vote-screen/index.html',
            'isBackgroundImage' => true,
            'isBackgroundColor' => false,
        ]);

        /* 批量投票 */
        ActivityModelTemplate::query()->firstOrCreate([
            'model_id' => $vote->getAttribute('id'),
            'name' => '投票(批量)',
            'template' => 'multiple-vote',
            'thumb' => '/images/admin/multiple-vote.png',
            'url' => '/act/multiple-vote/index.html',
            'isBackgroundImage' => true,
            'isBackgroundColor' => false,
        ]);

        $enroll = ActivityModel::query()->firstOrCreate([
            'name' => '报名',
            'rule' => 'enroll'
        ]);

        ActivityModelTemplate::query()->firstOrCreate([
            'model_id' => $enroll->id,
            'name' => '报名',
            'template' => 'default',
            'thumb' => '/images/admin/enroll.jpg',
            'url' => '/act/enroll/index.html',
            'isBackgroundImage' => true,
            'isBackgroundColor' => false,
        ]);

        $quiz = ActivityModel::query()->firstOrCreate([
            'name' => '问卷调查',
            'rule' => 'quiz',
        ]);

        ActivityModelTemplate::query()->firstOrCreate([
            'model_id' => $quiz->id,
            'name' => '问卷调查',
            'template' => 'default',
            'thumb' => '/images/admin/quiz.png',
            'url' => '/act/quiz/index.html',
            'isBackgroundImage' => true,
            'isBackgroundColor' => false,
        ]);

        $shaking = ActivityModel::query()->firstOrCreate([
            'name' => '摇一摇',
            'rule' => 'shaking',
        ]);

        ActivityModelTemplate::query()->firstOrCreate([
            'model_id' => $shaking->id,
            'name' => '摇一摇',
            'template' => 'default',
            'thumb' => '/images/admin/shaking.png',
            'url' => '/act/shake/index.html',
            'isBackgroundImage' => true,
            'isBackgroundColor' => false,
        ]);

        $roulette = ActivityModel::query()->firstOrCreate([
            'name' => '大转盘',
            'rule' => 'roulette',
        ]);

        ActivityModelTemplate::query()->firstOrCreate([
            'model_id' => $roulette->id,
            'name' => '大转盘',
            'template' => 'default',
            'thumb' => '/images/admin/roulette.png',
            'url' => '/act/roulette/index.html',
            'isBackgroundImage' => true,
            'isBackgroundColor' => false,
        ]);

        $scratch = ActivityModel::query()->firstOrCreate([
            'name' => '刮刮卡',
            'rule' => 'scratch',
        ]);

        ActivityModelTemplate::query()->firstOrCreate([
            'model_id' => $scratch->getAttribute('id'),
            'name' => '刮刮卡',
            'template' => 'default',
            'thumb' => '/images/admin/scratch.jpg',
            'url' => '/act/scratch/index.html',
            'isBackgroundImage' => true,
            'isBackgroundColor' => false,
        ]);

        $eggs = ActivityModel::query()->firstOrCreate([
            'name' => '砸金蛋',
            'rule' => 'golden-eggs',
        ]);

        ActivityModelTemplate::query()->firstOrCreate([
            'model_id' => $eggs->getAttribute('id'),
            'name' => '砸金蛋',
            'template' => 'default',
            'thumb' => '/images/admin/golden-eggs.png',
            'url' => '/act/golden-eggs/index.html',
            'isBackgroundImage' => true,
            'isBackgroundColor' => false,
        ]);
    }
}
